<?php

include '../include/connectBDD.php';

$mail = strtolower($_GET['mail']);
$confirm = strtolower($_GET['confirm']);
if ($mail == $confirm) {
    if (!empty($mail) && preg_match("#^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]{2,}\.[a-z]{2,4}$#", $mail)) {
        $req = "SELECT mail FROM user WHERE mail='" . $mail . "' ";
        $res = mysql_query($req) or die(mysql_error());
        $nb = mysql_num_rows($res);
        if ($nb == 0) {
            echo '0';
        } else {
            echo '1';
        }
    } else {
        echo '2';
    }
}else{
    echo '3';
}
?>